package com.mz.common.config;

import com.mz.common.interceptor.UserInfoInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig implements WebMvcConfigurer {

    /**
     * 注册自定义拦截器
     * */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        System.out.println("addInterceptors~~~~~");
        UserInfoInterceptor userInfoInterceptor = new UserInfoInterceptor();
        registry.addInterceptor(userInfoInterceptor).addPathPatterns("/**");
    }
}
